#include <iostream>
#include <sstream>
#include <bitset>
#include <cstdlib>
#include <stdio.h>
using namespace std;

int main() {
	std::ios_base::sync_with_stdio (true);
	long number = 0;
	while(scanf("%li",&number) != EOF) {
		bool ret = false;
		//cout << "num: " << number << endl;
		if(number == 0) {
			scanf("%*[^\n]");
			getc(stdin);
			continue;	
		} else if(number == 1) {
			ret = true;
			scanf("%*[^\n]");
			getc(stdin);
		} else {
			long counter = number;
			long prev, cur;
			bitset<3001> hash;
			bitset<3001> value;	
			scanf("%li",&cur);
			while(counter > 1) {
				prev = cur;
				scanf("%li",&cur); 
				long index= abs(prev - cur)-1;
				if(index < 0 || index > (number-2) || hash.test(index) == true) {
					//cout << " Counter: "  << counter <<" index: " << index << endl;
					ret = false;
					scanf("%*[^\n]");
					getc(stdin);
					goto DONE;
				} 
				hash.set(index);	
				value.set(--counter);
			}
			value.set(0);
			value.set(number-1, 0);
			ret = (hash == value);
		}
DONE:
		ret ? (cout << "Jolly" << endl) : (cout << "Not jolly" << endl);
	}
	return 0;	
}
